<#assign contextPath=springMacroRequestContext.getContextPath() />
<#import "/public/frame/main.html" as frame />
<@frame.head "南航明珠商城-商品列表">
</@frame.head>
<link rel="stylesheet" type="text/css" href="${contextPath}/resources/css/search_table.css" />
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 后台管理中心 <span class="c-gray en">&gt;</span>财务管理 <span class="c-gray en">&gt;</span> 供应商结算 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
<form method="post" name="query_supplierAccounts_form"  id="query_supplierAccounts_form" action="${contextPath}/supplierAccounts/supplierAccounts_order_list" >    
   <input type="hidden" name="page" value="${pagination.pageNo}"  id="page" />                          
    <div class="text-c">
        <table class="table search_table">
           <tr>  
           <td>订单编号：</td>
           <td>
           <input type="text" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();" class="input-text  radius" placeholder="订单编号" id="orderId" name="orderId" value="${(orderDetailQo.orderId?c)!}" >
           </td>

            <td>开始时间：</td>
            <td> 
       
          	<input 	onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'transTimeEnd\')||\'%y-%M-%d\'}',readOnly: true })" 
          			id="transTimeStart" name="transTimeStart" value="<#if orderDetailQo.transTimeStart?? >${orderDetailQo.transTimeStart?date}</#if>" 
           			class="input-text Wdate" readonly="" type="text">
			</td>
			<td>结束时间：</td>
            <td> 
                                              
               <input onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'transTimeStart\')}',maxDate:'%y-%M-%d',readOnly: true })"
               			id="transTimeEnd"   name="transTimeEnd" value="<#if orderDetailQo.transTimeEnd?? >${orderDetailQo.transTimeEnd?date}</#if>" 
               			class="input-text Wdate"  type="text">
           </td>
        </tr>
        <tr>
           <td>供应商名称：</td>
           <td>
                 <input type="text" class="input-text  radius" placeholder="供应商名称" id="merchantName" name="merchantName" value="${orderDetailQo.merchantName}" >
           </td>
           <td>商品编号：</td>
           <td>
                 <input type="text" class="input-text  radius" placeholder="商品编号" id="productId" name="productId" value="${orderDetailQo.productId}" >
           </td>
           <td>商品名称：</td>
           <td>
                 <input type="text" class="input-text  radius" placeholder="商品名称" id="productName" name="productName" value="${orderDetailQo.productName}" >
           </td>
         </tr>
         <tr>
           <td>结算状态：</td>
           <td>
                <span class="select-box radius" >  
                    <select class="select" name="status" id="status">
					    <option value>请选择</option>
					    <option <#if orderDetailQo.status==1 > selected="selected"</#if>  value="1">未结算</option>
					    <option <#if orderDetailQo.status==2 > selected="selected"</#if>  value="2">已结算</option>
					</select>
			    </span> 
           </td>
           <td></td>
           <td colspan="3">
             <input class="btn btn-success radius" type="button"  onclick="search();"  value="搜索" />
           	<input class="btn btn-success radius" type="button"  onclick="excelAll();"  value="导出" />
           </td>
         </tr>
      </table>
    </div>
</form>
    <div class="cl pd-5 bg-1 bk-gray mt-20"> 
    <span class="r">共有数据：<strong> ${pagination.totalCount} </strong> 条</span> </div>
    <table class="table table-border table-bordered table-bg" style="margin-top: -1px;">
        <thead>
        
        <tr   class="text-c">
            <!-- <th width="45px">
            <input  type="checkbox" id="selectAll" disabled="disabled" onclick="checkAll()"/>
            </th> -->
            <th  > 所属供应商</th>
            <th >商品编号</th>
            <th >商品名称</th>
            <th >支付时间</th>
            <th  > 商品数量</th>
            <th  > 里程单价</th>
            <th  > 总计</th>
            <th  > 状态</th>
            <th width="100" >操作</th>
        </tr>
        </thead>
        <tbody>
       <#if pagination.list?? && (pagination.list?size &gt; 0) >
        <#list pagination.list as orders> 
        	 <tr>
        	   	<td >${orders.product.merchant.mercName} </td>
        	   	<td >  
        	   	${orders.product.id}
        	   </td>
 				<td>   ${orders.product.baseInfo.name}  </td>
 				
 				 <td>  	${(orders.order.orderPayInfo.transTime?string("yyyy-MM-dd HH:mm:ss"))!}
 				 </td>
                
	 			<td>	${orders.buyNum}	
	 			</td>
	 			<td>
	 			${orders.mileages}
	 			</td>
	 			<td>${orders.buyNum*orders.mileages}
	 			</td>
	 			<td>
	 				<#if orders.status==1 >未结算
					<#elseif orders.status==2  > 已结算
                 	</#if>
	 			</td>
 			 	<td>
 			 	 <a href="javascript:detail('${orders.id}')"  ><font color="blue">查看详情</font></a>
 			 	 	<#if orders.status==1 >&nbsp;&nbsp;&nbsp;
				<a href="javascript:settleAccount('${orders.id}')"  ><font color="blue">结算</font></a>
                 	</#if>
 			 	</td>
        	 </tr>
      </#list></#if>
     </tbody>
    </table>
    <div id="biuuu_city" style="padding-top: 10px;float: right"></div>
</div>
<@frame.end "default">
</@frame.end>

<script type="text/javascript" src="${contextPath}/resources/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/laypage/laypage.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/order/search_order_list.js"></script>
<script type="text/javascript">
var path="${contextPath}";
laypage({
    cont: 'biuuu_city',//容器。值支持id名、原生dom对象，jquery对象。
    pages: ${pagination.totalPage},//通过后台拿到的总页数
    curr:  ${pagination.pageNo} || 1, //当前页
    skip: true, //是否开启跳页
	first: 1, //将首页显示为数字1,。若不显示，设置false即可
	last: ${pagination.totalPage}, //将尾页显示为总页数。若不显示，设置false即可
    jump: function(obj , first){//触发分页后的回调
        if(!first){ //点击跳页触发函数;当前页为obj.curr
          $(page).val(obj.curr);//获取点击的页码
          $(query_supplierAccounts_form).submit();
        }
    }
})  
function search(){
    $("#page").val("1");
    $("#query_supplierAccounts_form").attr("action",path+"/supplierAccounts/supplierAccounts_order_list").submit();
}	
	
function excelAll(){
	$("#query_supplierAccounts_form").attr("action",path+"/supplierAccounts/supplierAccounts_excel").submit();
}	
//结算
function settleAccount(id){
	if(confirm("您确定该订单明细已结算吗？") ==true){
	    $.ajax({
	     url:path+"/supplierAccounts/supplierAccounts_updateOrderDetailById?id="+id+"&status=1",
	     type:"post",
	     dataType:"text",
	     error:function(XMLHttpRequest,textStatus,errorThrown){},
	     success:function(msg){
	     	if(msg=="1"){
				layer.msg('结算成功',{icon:1,time:1000},function(){
		   			 window.location.href = window.location.href;
				});
	
	     	} else if(msg=="0"){
				layer.msg('结算失败',{icon:1,time:1000},function(){
		   			 window.location.href = window.location.href;
				});
	     	} else {
	     		layer.alert(msg);
	     	}
	     	
	      }
	     });
	   }
}
/* --------------查看详情 ---------------*/
function detail(id){

	   var index = layer.open({
		    type: 2,
		    title: '查看详情',
		    maxmin: true,
		    scrollbar: false,
		    content: path+"/supplierAccounts/supplierAccounts_detail?id="+id,
		    area: ['860px', '233px']
		    });
	 
}
</script>
</body>

</html>
 
